﻿using System;

namespace UniAspect.UnityCommon.ResolutionLogging
{
    public class LoggingDepthPolicy : ILoggingDepthPolicy
    {
        private int _currentDepth;

        public int Depth
        {
            get { return _currentDepth; }
        }

        public void Increment()
        {
            _currentDepth++;
        }

        public void Decrement()
        {
            if (_currentDepth == 0)
            {
                throw new InvalidOperationException("Cannot decrement logging depth below zero.");
            }

            _currentDepth--;
        }
    }
}